import {
	findBySettingInfo
} from "../api/public";

export default {
	data() {
		var userInfo = uni.getStorageSync('userInfo') || {
			avatarUrl: "",
			nickName: "",
			openId: "",
			auth: false,
			parentUser: {
				id: 0,
				avatar: "",
				nickname: "",
				name: ""
			},
			agent: {
				id: 1,
				name: ""
			}
		};
		var lang = uni.getStorageSync("lang")
		let key = "settingsKey"
		let settingsKey = uni.getStorageSync(key) || {
			"loginBgId": 0,
			"color": "transparent",
			"icp": "",
			"loginBgUrl": "",
			"about": "",
			"tel": "",
			"id": 0,
			"title": "",
			"userName": "",
			"logoId": 0,
			"logoUrl": ""
		}
		return {
			userInfo,
			isUg: lang == 'zh-UG',
			color: {
				primary: settingsKey.color
			},
			settings: settingsKey
		}
	},
	mounted: function() {
		var the = this;
		findBySettingInfo().then(res => {
			//console.log(res)
			the.color.primary = res.color
			the.settings = res;
		})

	}
}